{% extends "_base.html" %}

{% block navi %}
    <li class="active"><a href="{{ url_for('web.index') }}">首页</a></li>
    <li><a href="{{ url_for('web.my_collect') }}">收藏</a></li>
    <li><a href="{{ url_for('web.about') }}">关于</a></li>
{% endblock %}

{% block page_content %}
    <div class="page-header" style="margin-top: -10px;">
        <h3>非诉律师好帮手</h3>
    </div>
    <div class="form-wrap clearfix">
        <input type="hidden" value="{% if reverse %}high-search{% else %}search{% endif %}" id="toggle">

        <div id="search" style="display: {% if reverse %}none{% else %}block{% endif %}">
            <form method="POST" action="{{ url_for('web.search') }}" id="search-form">
                <div class="col-lg-8" style="padding-right: 3px">
                    <div class="input-group">
                        <input type="hidden" name="before" value="{{ keyword }}">
                        <input type="hidden" name="querytype" value="">
                        <input type="text" class="form-control"
                               placeholder="{% if showkeyword %}{{ showkeyword }}{% else %}搜索关键词{% endif %}"
                               name="keyword">
                <span class="input-group-btn">
                    <button class="btn btn-default" type="submit">
                        查找
                    </button>
                </span>
                    </div>
                </div>
                {% if submit %}
                    <button class="btn btn-default" type="submit" onclick="submitwhat('byresult');">
                        {{ submit }}
                    </button>
                {% endif %}
            </form>
        </div>
        <div id="high-search" style="display: {% if reverse %}block{% else %}none{% endif %}">
            <form method="POST" action="{{ url_for('web.high_search') }}" id="high-search-form">
                {% if not parsed %}
                    <div class="col-lg-5" style="padding-right: 3px">
                        <h5>标题关键词</h5>
                        <input type="text" class="form-control form-item" placeholder="包含以下全部关键词（以空格区分）" name="t-a">
                        <input type="text" class="form-control form-item" placeholder="包含以下部分关键词（以空格区分）" name="t-o">
                        <input type="text" class="form-control form-item" placeholder="不包含以下关键词（以空格区分）" name="t-n">
                    </div>
                    <div class="col-lg-5" style="padding-right: 3px">
                        <h5>内容关键词</h5>
                        <input type="text" class="form-control form-item" placeholder="包含以下全部关键词（以空格区分）" name="c-a">
                        <input type="text" class="form-control form-item" placeholder="包含以下部分关键词（以空格区分）" name="c-o">
                        <input type="text" class="form-control form-item" placeholder="不包含以下关键词（以空格区分）" name="c-n">
                    </div>
                {% else %}
                    <div class="col-lg-5" style="padding-right: 3px">
                        <h5>标题关键词</h5>
                        <input type="text" class="form-control form-item" placeholder="包含以下全部关键词（以空格区分）" name="t-a" value="{{ ' '.join(parsed['t-a']) }}">
                        <input type="text" class="form-control form-item" placeholder="包含以下部分关键词（以空格区分）" name="t-o" value="{{ ' '.join(parsed['t-o']) }}">
                        <input type="text" class="form-control form-item" placeholder="不包含以下关键词（以空格区分）" name="t-n" value="{{ ' '.join(parsed['t-n']) }}">
                    </div>
                    <div class="col-lg-5" style="padding-right: 3px">
                        <h5>内容关键词</h5>
                        <input type="text" class="form-control form-item" placeholder="包含以下全部关键词（以空格区分）" name="c-a" value="{{ ' '.join(parsed['c-a']) }}">
                        <input type="text" class="form-control form-item" placeholder="包含以下部分关键词（以空格区分）" name="c-o" value="{{ ' '.join(parsed['c-o']) }}">
                        <input type="text" class="form-control form-item" placeholder="不包含以下关键词（以空格区分）" name="c-n" value="{{ ' '.join(parsed['c-n']) }}">
                    </div>
                {% endif %}
                <div class="col-lg-12 form-item">
                    <button class="btn btn-default" type="submit">
                        查找
                    </button>
                </div>
            </form>

        </div>


        {#    <br>#}
        {% if not showkeyword %}
            <div class="switch-btn">
                <a onclick="change()" id="switch-a">{% if reverse %}普通搜索{% else %}高级搜索{% endif %}</a>
            </div>
        {% endif %}
    </div>

    <div class="results">
        {% for item in data %}
            <hr>
            <div class="result_item">
                <h4 class="title">
                    <a href="{{ url_for('web.detail', sid=item.id) }}" target="_blank">{{ item.title }}</a>
                </h4>

                <p><span class="time">{{ item.releaseTime }} - </span> {{ item.description|safe }} </p>

                <p>{{ item.stockCode }} - {{ item.companyShortName }}
                    {% if item.type %}
                        - {{ item.type }}
                    {% endif %}
                </p>
            </div>
        {% endfor %}
    </div>

    {% block pagebar %}{% endblock %}

{% endblock %}
